using UnityEngine;
using System.Collections;

public class ProgressBar : MonoBehaviour 
{
	UIProgressBar m_Progress;
	float currentFill = 1.0f;
	float maxFill = 1.0f;
	void Awake()
	{
		m_Progress = transform.FindChild("PlayerHealthBar").GetComponent<UIProgressBar>();
		Debug.Log(m_Progress);
	}
	// Use this for initialization
	void Start () 
	{
		m_Progress.Value = 1.0f;
		Debug.Log(m_Progress);
	}
	
	// Update is called once per frame
	void Update () 
	{
		m_Progress.Value = (currentFill/maxFill) ;
	}
	public void IncreaseBar(float _value)
	{
		currentFill += _value;
		if(currentFill >= maxFill)
			currentFill = maxFill;
		
	}
	public void DecreaseBar(float _value)
	{
		currentFill -= _value;
		if(currentFill <= 0.0f)
			currentFill = 0.0f;
	}
	public void SetMax(float _value)
	{
		maxFill = _value;
	}
	public void SetBarValue(float _value)
	{
		Debug.Log("BarValue" + currentFill/maxFill);
		currentFill = _value;
	}
}
